<template>
<div>
	<h3 class="base-title">基础用法</h3>
	<p class="base-content"></p>

	<div class="demo-block" :class="{'show-case-core':caseObj1.showCoreFlag}">
		<div class="demo-block-source">
			<bh-result title="成功提示" subTitle="请根据提示进行操作">
				<template slot="extra">
					<bh-button type="primary" size="medium">返回</bh-button>
				</template>
			</bh-result>
			<bh-result icon="success" title="成功提示" subTitle="请根据提示进行操作">
				<template slot="extra">
					<bh-button type="primary" size="medium">返回</bh-button>
				</template>
			</bh-result>
			<bh-result icon="warning" title="警告提示" subTitle="请根据提示进行操作">
				<template slot="extra">
					<bh-button type="primary" size="medium">返回</bh-button>
				</template>
			</bh-result>
		</div>
		<div class="demo-block-core">
			<textarea class="demo-core-box" readonly="readonly" v-model="caseSourceVal" style='height: 240px;'></textarea>
		</div>
		<div class="demo-block-footer">
			<div class="demo-ms-arr" @click='toggleDemoCore(caseObj1)'>
				<span class="demo-ms-s">显示代码</span>
				<span class="demo-ms-h">隐藏代码</span>
			</div>
			<a :href="caseObj1.coreUrl" target="_blank" class="demo-online" title="前往 codepen.io 运行此示例">在线运行</a>
		</div>
	</div>
</div>
</template>

<script>
const caseSourceVal = `
<bh-result title="成功提示" subTitle="请根据提示进行操作">
	<template slot="extra">
		<bh-button type="primary" size="medium">返回</bh-button>
	</template>
</bh-result>
<bh-result icon="success" title="成功提示" subTitle="请根据提示进行操作">
	<template slot="extra">
		<bh-button type="primary" size="medium">返回</bh-button>
	</template>
</bh-result>
<bh-result icon="warning" title="警告提示" subTitle="请根据提示进行操作">
	<template slot="extra">
		<bh-button type="primary" size="medium">返回</bh-button>
	</template>
</bh-result>
`;
export default {
	data () {
		return {
			caseObj1: {
				showCoreFlag: false,
				coreUrl: 'https://codepen.io/xiebaolin/pen/abyOWOm',
			},
			caseSourceVal: caseSourceVal,
		};
	},
	methods: {
		// 切换代码显隐
		toggleDemoCore (item) {
			item.showCoreFlag = !item.showCoreFlag;
		},
	},
}
</script>

<style scoped>
</style>
